package com.example.dyxeapplication.menu.bermain;

import com.example.dyxeapplication.R;
import com.example.dyxeapplication.menu.Menu;
import com.example.dyxeapplication.menu.ejaan.Menu_Ejaan_Bermain;

import android.app.Activity;
import android.content.Intent;
import android.media.MediaPlayer;
import android.os.Bundle;
import android.view.View;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;

public class End_Game_Activity_Ejaan extends Activity{
	private MediaPlayer mp;
	private View view1, view2, view3, view4, view5, view6, view7;
    private Animation mAnimation1, mAnimation2;
	
	@Override
	public void onCreate(Bundle savedInstanceState){
		super.onCreate(savedInstanceState);
		setContentView(R.layout.end_game);
		mp = MediaPlayer.create(this, R.raw.soundberhasil);
		mp.start();
		
		view1 = findViewById(R.id.balon1);
		view2 = findViewById(R.id.balon2);
		view3 = findViewById(R.id.balon3);
		view4 = findViewById(R.id.balon4);
		view5 = findViewById(R.id.balon5);
		view6 = findViewById(R.id.balon6);
		view7 = findViewById(R.id.balon7);
		
		mAnimation1 = AnimationUtils.loadAnimation(getApplicationContext(),
				R.animator.move);
		mAnimation2 = AnimationUtils.loadAnimation(getApplicationContext(),
				R.animator.move2);
		
		view1.startAnimation(mAnimation1);
		view2.startAnimation(mAnimation1);
		view3.startAnimation(mAnimation1);
		view4.startAnimation(mAnimation1);
		view5.startAnimation(mAnimation2);
		view6.startAnimation(mAnimation2);
		view7.startAnimation(mAnimation2);
	}
	
	@Override
	public void onPause() {
		super.onPause();
		// Release the MediaPlayer if going into background
		if (mp != null)
			mp.release();
	}
	
	@Override
	public void onBackPressed() {
		
	}
	
	public void home(View v){
		Intent myIntent = new Intent(this, Menu.class);
		myIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
		startActivity(myIntent);
	}
	
	public void repeatGame(View v){
		Intent myIntent = new Intent(this, Menu_Ejaan_Bermain.class);
		myIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
		startActivity(myIntent);
	}
}
